<%=  devise_error_messages!  rescue '' %>

<div id="password_form" class="panel panel-default">

  <header class="panel-heading">
    <h5>
      <%= link_to t("settings.password_change.briefing"),  "javascript:void(0);", class: 'accordion-toggle', "data-toggle" => 'collapse', "data-parent" => "#settings-accordion", "data-target" => "#password_form_content" %>
    </h5>
  </header>

  <div class="panel-body collapse" id="password_form_content">
    <%= form_for(resource, :class => "form-group", :as => resource_name, :url => registration_path(resource_name), :html => { :id => "user_password_form", :method => :put }) do |f| %>

      <%= f.label t('account.password.new') %>
      <%= f.password_field :password, :class => "form-control" %>

      <%= f.label t('account.password.retype') %>
      <%= f.password_field :password_confirmation, :class => "form-control" %>

      <%= f.label t('account.password.current') %>
      <%= f.password_field :current_password, :class => "form-control" %>

      <%= f.submit t('button.update'), :class => "btn btn-primary", "data-loading-text" => t('button.sending') %>
    <% end%>
  </div>
</div>


<div id="email_form" class="panel panel-default">
  <header class="panel-heading">
    <h5>
      <%= link_to t("settings.email_change.briefing"),  "javascript:void(0);", class: 'accordion-toggle', "data-toggle" => "collapse", "data-parent" => "#settings-accordion", 'data-target' => '#email_form_content' %>
    </h5>
  </header>

  <div class="panel-body content settings_content collapse" id="email_form_content">
    <%= form_for(resource, :class => "form-group", :as => resource_name, :url => registration_path(resource_name), :html => { :id => "user_email_form", :method => :put }) do |f| %>
        <%= f.label :email %>
        <%= f.email_field :email, :class => "required form-control" %>
    
        <%= f.label :current_password %>
        <%= f.password_field :current_password, :class => "required form-control", :id=>"user_current_password2" %>
  
        <%= f.submit t('button.update'), :class => "btn btn-primary", "data-loading-text" => t('button.sending') %>
    <% end %>
  </div>
</div>

<% content_for :javascript do %>
  $(".user_edit").validate({errorClass: "validation_error"});

  $("#password_form_content .edit_user [type='submit']").click(function(event){
    $(this).button('loading');
  });

  $("#email_form .edit_user [type='submit']").click(function(event) {
    $(this).button('loading');
  });
<%end%>

